// 这里是方法
import {
  ADD_GOOD_COUNT, ADD_GOOD, CHANGE_ALL_CHECK, CHANGE_ONE_CHECK
} from "./mutations-types"

export default {
  // 这里计算便于跟踪
  [ADD_GOOD_COUNT](state, payload) {
    payload.count++
  },
  [ADD_GOOD](state, payload) {
    state.cartList.push(payload)
  },
  [CHANGE_ALL_CHECK](state, payload) {
    state.cartList.map((item) => item.check = payload)
  },
  [CHANGE_ONE_CHECK](state, payload) {
    payload.check = !payload.check
  }
}
